﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="Search.aspx.vb" Inherits="WuggiSum.Search" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

        <table align="center">
            <tr>
                <td><asp:TextBox ID="TB_search" runat="server"></asp:TextBox></td>
                <td><asp:Button ID="btn_search" runat="server" Text="Search" /></td>
            </tr>
        </table>
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            DataKeyNames="m_id" DataSourceID="WugSource" Width="100%" AllowSorting="True" AlternatingRowStyle-BackColor="#E6E6E6" AllowPaging="True">
            <Columns>
                <asp:HyperLinkField DataNavigateUrlFields="m_id" DataNavigateUrlFormatString="details.aspx?WuggiQuery={0}" DataTextField="m_title" HeaderText="Title" SortExpression="m_title" />
                <asp:ImageField DataImageUrlField="m_poster" DataImageUrlFormatString="/Images/{0}" HeaderText="Poster's Thumbnail">
                    <ControlStyle CssClass="Thumbnails"> </ControlStyle> 
                    <ItemStyle HorizontalAlign="Center" />
                </asp:ImageField>
                <asp:BoundField DataField="m_pg" HeaderText="PG Rating" SortExpression="m_pg" />
                <asp:BoundField DataField="m_year" HeaderText="Year" SortExpression="m_year" />
                <asp:BoundField DataField="s_genre" HeaderText="Subgenre" SortExpression="s_genre" />
            </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="WugSource" runat="server" 
            ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
            ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" 
            
        SelectCommand="SELECT a.[m_id], a.[m_title], a.[m_poster], a.[m_pg], a.[m_year], b.[s_genre] FROM [movies] a , [subgenre] b where a.[sub_id] = b.[sub_id] and ([m_title] like '%' + @m_title + '%' )">
            <SelectParameters>
                <asp:QueryStringParameter Name="m_title" QueryStringField="title" 
                    Type="String" />
            </SelectParameters>
        </asp:SqlDataSource>

</asp:Content>
